package com.xuan.bigdog.lib.chat.enums;

/**
 * 消息的发送状态
 * 
 * @author xuan
 */
public enum DGMessageSentStatus {
	// 1：发送失败、2：发送中、3：发送成功
	FAILED(1), SENDING(2), SENT(3);

	private int value;

	DGMessageSentStatus(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public static DGMessageSentStatus valueOf(int value) {
		DGMessageSentStatus messageSentStatus = null;
		switch (value) {
		case 1:
			messageSentStatus = FAILED;
			break;
		case 2:
			messageSentStatus = SENDING;
		case 3:
			messageSentStatus = SENT;
			break;
		default:
			messageSentStatus = FAILED;// 默认就算发送失败
			break;
		}
		return messageSentStatus;
	}

	public String getDescription() {
		String desc = null;
		switch (this) {
		case FAILED:
			desc = "发送失败";
			break;
		case SENDING:
			desc = "发送中";
			break;
		case SENT:
			desc = "发送完成";
			break;
		default:
			desc = "发送失败";// 默认就算发送失败
			break;
		}
		return desc;
	}

	@Override
	public String toString() {
		return getDescription();
	}

	public boolean equals(DGMessageSentStatus messageSentStatus) {
		if (null == messageSentStatus) {
			return false;
		}
		return value == messageSentStatus.value;
	}

}
